package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;

@Getter@Setter
public class Strategy extends BaseDomain{
    public static final Integer STATE_COMMON = 0;//普通
    public static final Integer STATE_HOT = 1;//热门
    public static final Integer STATE_DISABLE = -1;//禁用

    private Region place;

    private String title;

    private String subTitle;

    private String coverUrl;

    private Integer state;

    public String getStateName(){
        String temp = "普通";
        if(STATE_HOT == state){
            temp = "热门";
        }else if(STATE_DISABLE == state){
            temp = "禁用";
        }
        return temp;
    }
    public String getJson(){
        HashMap map = new HashMap<>();
        map.put("id",id);
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        map.put("state",state);
        if(place!=null){
            map.put("placeId",place.getId());
            map.put("placeName",place.getName());
        }
        return JSONUtil.toJSONString(map);
    }
}